﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using RuleCode.Table;
namespace map.member.money
{
    public partial class balance : System.Web.UI.Page
    {
        protected   double  totalMoney = 0.0;
        protected   double dongjieMoney = 0.0;
        protected   double keyongMoney = 0.0;
        protected cbuser user;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitBalance();
            }
        }

        private void InitBalance()
        {
            if (AliApi.appUserId != string.Empty)
            {
                user = cbuser.Find("cbuserid='"+AliApi.appUserId +"'");
                if (user.Count > 0)
                {
                    totalMoney = user.cbmoney.Value + user.cbmoneyD.Value;
                    dongjieMoney = user.cbmoneyD.Value;
                    keyongMoney = user.cbmoney.Value ;
                }
            }
        }

        protected string GetAccountNumber()
        {
            string result = string.Empty;
            if (user.Count > 0)
            {
                result = user.BankAccount.Value;
                if (result.Length > 7)
                {
                    string newResult = result;
                    result = string.Empty;
                    for (int i = 0; i < newResult.Length; i++)
                    {
                        if (i % 4 == 0 && i != 0)
                            result += " ";
                        if (i < 4 || i > newResult.Length - 4)
                            result += newResult[i].ToString();
                        else
                            result += "*";
                    }
                }
            }
            return result;
        }
        
    }
}
